#ifndef HQLABEL_H
#define HQLABEL_H

#include <QObject>
#include <QLabel>
#include <QMovie>
#include "huaqimovie.h"
#include "common.h"
#include <QSettings>
#include <QTextCodec>
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include <QSequentialAnimationGroup>
#include <QPainter>
#include <QGraphicsSimpleTextItem>
#include <QGraphicsProxyWidget>
#include <QTimer>
#include <QDateTime>
#include "myanimation.h"
#include "myplaceway.h"
#include "common.h"

class HqLabel : public QLabel
{
    Q_OBJECT
public:
    HqLabel();
    ~HqLabel();
    void SetContent(QString prefix, QString url);
    void StartHqv();
    void CleanHqv();
    void SetHqvCnt(QString prefix, QString url);
    void SetGifCnt(QString prefix, QString url);
    void SetPngCnt(QString prefix, QString animation_url);
    void SetHqtCnt(QString prefix, QString text);
    void RunHqtStyle(QString text, QString qss1 = "", QString qss2 = "", QString place_way = "PH", Animation animation = None, QString format = "");
    void RunPngStyle(QString url, Animation animation = None);
    void ClearChild();
    void SetGrabPixmap();
    QList<int>  GetFormatParaNum(const QString &format);
    void ReLoadUrl(QString prefix, QString url);
    void StartScrollText(QString qss);

    QString GetUrl();

    //设置标志位，show之后截屏显示
    void SetGrabFlag(int flag) {m_grab_flag = flag;}
    int  GetGrabFlag() {return m_grab_flag;}

    //show之后重新显示
    void ReRunHqtRotateGrabAnimation(Animation animation);

private slots:
    void paintEvent(QPaintEvent *event);
    void UpdateIndex();

private:
    QMovie*         m_movie;
    HuaqiMovie*     hq_movie;
    int             m_grab_flag;

    MyPlaceWay *m_layout;
    MyAnimation *m_animation;

    QString m_qss1;
    QString m_qss2;
    QString m_place_way;
    QString m_format;
    Animation m_animation_int;

    QString m_url;

    int m_text_width;
    int m_text_height;
    int m_pos_x;
    QString m_rolling_text;
    QTimer m_timer;
};

#endif // HQLABEL_H
